#include "BoatEntity.h"




BoatEntity::BoatEntity(int id, int type, double x, double y)
{
	_data = new BoatData(id, type, x, y);

	_nextX = _data->getRect()->X;
	_x0 = _data->getRect()->X;
	_data->getRect()->Vx = BOAT_V;
}

void BoatEntity::update(long time)
{
	_nextX += _data->getRect()->Vx;
	if(_nextX >= (_x0 + BOAT_MOVING_RANGE) || _nextX <= (_x0 - BOAT_MOVING_RANGE))
	{
		_data->getRect()->Vx *= (-1);
	}

	_data->getRect()->X += _data->getRect()->Vx;
	_data->sprites->updateCurrent();
}

void BoatEntity::draw(long time)
{
	_data->sprites->draw();
}

AbstractData* BoatEntity::getAbstractData()
{
	return _data;
}
